package com.bingxue.edu.common.enums;

import com.bingxue.edu.framework.enums.DictEnum;
import com.fasterxml.jackson.annotation.JsonValue;
import com.mybatisflex.annotation.EnumValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum QuestionModuleEnum implements DictEnum<Integer> {
    JS(1, "计算"),
    XC(2, "行程"),
    YYT(3, "应用题"),
    JH(4, "几何"),
    SL(5, "数论"),
    ZHJS(6, "组合计数");

    @EnumValue
    @JsonValue
    private final Integer value;
    private final String label;

    // 根据 label 获取枚举值
    public static QuestionModuleEnum getByLabel(String label) {
        for (QuestionModuleEnum type : QuestionModuleEnum.values()) {
            if (type.getLabel().equalsIgnoreCase(label)) {
                return type;
            }
        }
        return  null;
    }
}